"use client";

/**
 * [...reset] 这种命令的，是自动捕获所有路由
 * [[...reset]] 可选的捕获路由
 * 创建新的路由的时候，必须得有page组件
 */

import { EmptyOrg } from "../_components/empty-org";
import { useOrganization } from "@clerk/nextjs";
import BoardList from "../_components/board-list";

interface DashboardPageProps {
  searchParams: {
    search?: string;
    favorites?: string;
  };
}

const DashboardPage = ({ searchParams }: DashboardPageProps) => {
  const { organization } = useOrganization();

  return (
    <div className="flex-1 h-[calc(100%-80px)] p-6">
      {!organization?.id ? (
        <EmptyOrg />
      ) : (
        <BoardList orgId={organization.id} query={searchParams} />
      )}
    </div>
  );
};

export default DashboardPage;
